Adjust binary encoding of import/export names#623
Merged
lukewagner merged 3 commits intoWebAssembly:mainfrom Mar 31, 2026
Merged
Adjust binary encoding of import/export names#623lukewagner merged 3 commits intoWebAssembly:mainfrom
lukewagner merged 3 commits intoWebAssembly:mainfrom
Conversation
lukewagner
approved these changes
Mar 23, 2026
Member
lukewagner
left a comment
There was a problem hiding this comment.
Thanks for the fix (and sorry for the delay)! lgtm with 2 tweaks:
design/mvp/Binary.md
Outdated
| versionsuffix' ::= len:<u32> vs:<semversuffix> => (versionsuffix vs) (if len = |vs|) 🔗 | ||
| import ::= in:<importname> ed:<externdesc> => (import in ed) | ||
| export ::= en:<exportname> si:<sortidx> ed?:<externdesc>? => (export en si ed?) | ||
| importname ::= 0x00 len:<u32> in:<importname> => in (if len = |in|) |
Member
There was a problem hiding this comment.
The goal of importname'/exportname' was avoid the confusion in this line, which otherwise looks recursive. One alternative idea is to say <text:importname> (and then update the bullet below which establishes the link of importname to the text format).
Collaborator
Author
There was a problem hiding this comment.
Oh good point, updated back to a ' trailer
The purpose of this commit is to address the discrepancy between the specification and wasm-tools discovered in WebAssembly#622. The history here is: * WebAssembly#222 - historical addition of `(interface "name")` as an import/export name. * WebAssembly#263 - moral revert of the previous change where the kind of name was now encoded in the name instead. At this point `Binary.md` mistakenly no longer reflected what wasm-tools parsed. * WebAssembly#536 - addition of more metadata to import/export names with a discriminator byte that overlapped the previous. This commit is is an adjustment to `Binary.md` to fix these discrepancies. Notably `exportname` and `importname` productions, previously absent. The `exportname'` and `importname'` productions are now renamed to `exportname` and `importname`. Additioanlly the production with `versionsuffix'` have been renumbered to `0x02` while an `0x01` production was added which is the exact same as `0x00` (intended for historical compat). A note was updated in the 1.0 binary adjustments to clean this up. Closes WebAssembly#622
3cc92af to
0b458c7
Compare
lukewagner
reviewed
Mar 31, 2026
Co-authored-by: Luke Wagner <mail@lukewagner.name>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The purpose of this commit is to address the discrepancy between the specification and wasm-tools discovered in #622. The history here is:
(interface "name")as an import/export name.Binary.mdmistakenly no longer reflected what wasm-tools parsed.This commit is is an adjustment to
Binary.mdto fix these discrepancies. Notablyexportnameandimportnameproductions, previously absent. Theexportname'andimportname'productions are now renamed toexportnameandimportname. Additioanlly the production withversionsuffix'have been renumbered to0x02while an0x01production was added which is the exact same as0x00(intended for historical compat). A note was updated in the 1.0 binary adjustments to clean this up.Closes #622